﻿-- =========================================================================================================
-- Author:		MICHAEL RITACCO
-- Copyright:	2010 MEKHANO GROUP LLC
-- Version:		08/21/2010 1.0
-- =========================================================================================================
CREATE PROCEDURE [flcr].[api_service_sel_lov]
	@SERVICE_ID INT = NULL
	,@SERVICE_TYPE INT = NULL
	,@DOMAIN_ID INT = NULL

AS
BEGIN
  
	SELECT	B.[DOMAIN_NAME]
			,A.[SERVICE_ID] 
			,A.[SERVICE_NAME]
			,A.[PARENT_ID]
			,A.[SERVICE_TYPE]
			,C.[SERVICE_TYPE_NAME]
	  FROM	[flcr].[SERVICE] A
	 INNER JOIN [flcr].[DOMAIN] B
		ON	A.[DOMAIN_ID] = B.[DOMAIN_ID]
	 INNER JOIN flcr.[SERVICE_TYPE] C
		ON  A.[SERVICE_TYPE] = C.[SERVICE_TYPE] 
	 WHERE	A.[SERVICE_ID] = COALESCE(@SERVICE_ID, A.[SERVICE_ID])
	   AND	A.[SERVICE_TYPE] = COALESCE(@SERVICE_TYPE, A.[SERVICE_TYPE])
	   AND	B.[DOMAIN_ID] =  COALESCE(@DOMAIN_ID, B.[DOMAIN_ID])

END